{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block page_content %}
<div class="question form">
    {% if current_user.can(Permission.WRITE_ARTICLES) %}
        {{ wtf.quick_form(form) }}
    {% endif %}
</div>
<br>
<ul id="myTab" class="nav nav-tabs">
    <li {% if not show_ques %} class="active" {% endif %}><a href="{{ url_for('.show_answer') }}">回答</a></li>
    <li {% if show_ques %} class="active" {% endif %}><a href="{{ url_for('.show_question') }}">问题</a></li>
</ul>
<br>
<br>
<ul class="index-answer">
    {% for answer in answers %}
    <li class="answer">
        <div class="question-title">
            <div class="a_index-thumbnail">
                <a href="{{ url_for('.profile', id=answer.author.id) }}">
                    <img class="img-rounded" src="{{ answer.author.gravatar(size=35) }}">
                </a>
            </div>
            <div class="a_index-content">
                <div>
                    <h6><a href="{{ url_for('.profile', id=answer.author.id) }}">
                        {{ answer.author.username }}</a>回答了该问题</h6>
                        <h6>{{ moment(answer.timestamp).fromNow() }}</h6>
                </div>
                <div class="a_index-question-title">
                    <h4>
                        <a href="{{ url_for('.question', id=answer.question.id) }}">
                            {{ answer.question.title }}
                        </a>
                    </h4>
                </div>
                {{ answer.body }}
                <div class="a_index-show-question-button">
                    <a class="btn btn-info btn-xs" href="{{ url_for('.question', id=answer.question_id) }}">显示问题</a>
                </div>
            </div>
            <div class="data"></div>
        </div>
    </li>
    {% endfor %}
    {% if a_pagination %}
    <div class="pagination">
        {{ macros.pagination_navigate(a_pagination, '.index') }}
    </div>
    {% endif %}
</ul>
{% endblock %}